import 'package:flutter/material.dart';
import 'package:ivc/views/factory/gain_order_capability.dart';
import 'package:ivc/views/lending/lending_order_list.dart';
import 'package:ivc/views/parts/parts_order_list.dart';
//import '../../model/bizmodel.dart';
import "../../model/test_data.dart";
import "../../routers/application.dart";
import '../mr/mr_order_list.dart';
import "gain_order_capability.dart";

class OrderList extends StatefulWidget {
  final String category;
  final int tab;
  OrderList({Key key, this.tab: 0, this.category}) : super(key: key);

  @override
  _OrderListState createState() => _OrderListState();
}

class _OrderListState extends State<OrderList> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: DefaultTabController(
        length: 5,
        initialIndex: this.widget.tab,
        child: Scaffold(
          appBar: AppBar(
            bottom: TabBar(
              tabs: [
                Tab(icon: Icon(Icons.call_split), text: '订单'), //Tmall
                Tab(icon: Icon(Icons.category), text: '零配件'), //Tmall
                Tab(icon: Icon(Icons.monetization_on), text: '融租'), //Alipay
                Tab(icon: Icon(Icons.build), text: '维修'), //到家
                Tab(icon: Icon(Icons.ac_unit), text: '二手'), //转转
              ],
            ),
            title: Text('商务中心'),
            actions: <Widget>[
              IconButton(
                icon: Icon(Icons.fullscreen),
                onPressed: () async {
                  Application.router.navigateTo(context, "/scanner");
                },
              ),
            ],
          ),
          body: TabBarView(
            children: [
              GainOrderCapabilityPage(),
              PartsOrderList(
                  items: TestData.internalData.listOfPartsOrder,
                  exchange: false),
              LendingOrderList(items: TestData.internalData.listOfLendingOrder),
              MROrderList(items: TestData.internalData.listOfMROrder),
              PartsOrderList(
                  items: TestData.internalData.listOfPartsOrder,
                  exchange: true),
            ],
          ),
        ),
      ),
    );
  }
}
